#include "graphsupport/graph/operation/GeneratePricesOperation.h"

#include <iostream>

GeneratePricesOperation::GeneratePricesOperation()
{
}

void GeneratePricesOperation::applyTo(
	Graph & graph,
	IOperationSettings & genSettings
)
{
	FacilitiesGraph * fgraph = dynamic_cast< FacilitiesGraph * >( & graph );
	if ( !fgraph )
	{
		return;
	}
	int facilitiesCount = fgraph->getFacilitiesCount();
	for ( int i = 0; i < facilitiesCount; i++ )
	{
		FacilitiesGraph::FacilityPriceType price = genSettings.facilityPriceBeg +
			genSettings.randomDouble() * genSettings.facilityPriceRange;
		fgraph->facilitiesPrices[i] = price;
	}
}
